
import 'package:flutter/material.dart';

class Painter extends CustomPainter {
  void Function(Canvas canvas, Size size) paintMethod;
  bool Function(CustomPainter oldDelegate) shouldRepaintMethod;

  Painter({this.paintMethod, this.shouldRepaintMethod}) : assert(paintMethod != null && shouldRepaintMethod != null);
  @override
  void paint(Canvas canvas, Size size) => paintMethod(canvas, size);

  @override
  bool shouldRepaint(CustomPainter oldDelegate) => shouldRepaintMethod(oldDelegate);
}
